package com.zttek.photosShareProject.common.json;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zttek.photosShareProject.modules.model.Share;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Y
 * Date: 2017-08-28
 * Time: 15:31
 */
public class ShareVO implements VO {

    private Long shareId;
    private ImageVO[] images;
    private UserVO author;
    private String description;
    private Integer totalPraise;
    private Integer totalComment;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    private Long source;
    private boolean hasPraise = false;
    private boolean hasHide = false;
    private boolean hasCollect = false;
    private UserVO[] atUsers;
    private CommentVO fastComment;

    public ShareVO() {
    }

    public ShareVO(Share share, ImageVO[] images, UserVO userVO, boolean praise, boolean hide, boolean collect, UserVO[] atUsers){
        shareId = share.getId();
        this.images = images;
        author = userVO;
        description = share.getDescription();
        totalPraise = share.getTotalPraise();
        totalComment = share.getTotalComment();
        createTime = share.getCreateTime();
        source = share.getSource();
        hasPraise = praise;
        hasHide = hide;
        this.atUsers = atUsers;
        hasCollect = collect;
    }

    public Long getShareId() {
        return shareId;
    }

    public void setShareId(Long shareId) {
        this.shareId = shareId;
    }

    public ImageVO[] getImages() {
        return images;
    }

    public void setImages(ImageVO[] images) {
        this.images = images;
    }

    public UserVO getAuthor() {
        return author;
    }

    public void setAuthor(UserVO author) {
        this.author = author;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getTotalPraise() {
        return totalPraise;
    }

    public void setTotalPraise(Integer totalPraise) {
        this.totalPraise = totalPraise;
    }

    public Integer getTotalComment() {
        return totalComment;
    }

    public void setTotalComment(Integer totalComment) {
        this.totalComment = totalComment;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getSource() {
        return source;
    }

    public void setSource(Long source) {
        this.source = source;
    }

    public boolean isHasPraise() {
        return hasPraise;
    }

    public void setHasPraise(boolean hasPraise) {
        this.hasPraise = hasPraise;
    }

    public boolean isHasHide() {
        return hasHide;
    }

    public void setHasHide(boolean hasHide) {
        this.hasHide = hasHide;
    }

    public boolean isHasCollect() {
        return hasCollect;
    }

    public void setHasCollect(boolean hasCollect) {
        this.hasCollect = hasCollect;
    }

    public UserVO[] getAtUsers() {
        return atUsers;
    }

    public void setAtUsers(UserVO[] atUsers) {
        this.atUsers = atUsers;
    }

    public CommentVO getFastComment() {
        return fastComment;
    }

    public void setFastComment(CommentVO fastComment) {
        this.fastComment = fastComment;
    }

    public static class GetListForm{
        private Integer pageNum;
        private Integer pageSize;
        private String orderByField;
        private Long userId;
        private boolean ascend;

        public Integer getPageNum() {
            return pageNum;
        }

        public void setPageNum(Integer pageNum) {
            this.pageNum = pageNum;
        }

        public Integer getPageSize() {
            return pageSize;
        }

        public void setPageSize(Integer pageSize) {
            this.pageSize = pageSize;
        }

        public String getOrderByField() {
            return orderByField;
        }

        public void setOrderByField(String orderByField) {
            this.orderByField = orderByField;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public boolean isAscend() {
            return ascend;
        }

        public void setAscend(boolean ascend) {
            this.ascend = ascend;
        }
    }

    public static class RelevanceForm {

        private Long shareId;
        private Long userId;
        private boolean direction;

        public Long getShareId() {
            return shareId;
        }

        public void setShareId(Long shareId) {
            this.shareId = shareId;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public boolean isDirection() {
            return direction;
        }

        public void setDirection(boolean direction) {
            this.direction = direction;
        }
    }

    public static class createForm{

        private Long[] imageIds;
        private String content;
        private Long[] atIds;
        private Long userId;
        private Long sourceId;
        private boolean hide;

        public Long[] getImageIds() {
            return imageIds;
        }

        public void setImageIds(Long[] imageIds) {
            this.imageIds = imageIds;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public Long[] getAtIds() {
            return atIds;
        }

        public void setAtIds(Long[] atIds) {
            this.atIds = atIds;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public Long getSourceId() {
            return sourceId;
        }

        public void setSourceId(Long sourceId) {
            this.sourceId = sourceId;
        }

        public boolean isHide() {
            return hide;
        }

        public void setHide(boolean hide) {
            this.hide = hide;
        }
    }

    public static class SearchForm{

        private Integer pageNum;
        private Integer pageSize;
        private String q;
        private Long userId;

        public Integer getPageNum() {
            return pageNum;
        }

        public void setPageNum(Integer pageNum) {
            this.pageNum = pageNum;
        }

        public Integer getPageSize() {
            return pageSize;
        }

        public void setPageSize(Integer pageSize) {
            this.pageSize = pageSize;
        }

        public String getQ() {
            return q;
        }

        public void setQ(String q) {
            this.q = q;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }
    }
}
